jQuery(function () {
    jQuery("#goodsSearch").click(function () {
        var name = jQuery("#goodsName").val()
        location.href = "?name=" + encodeURI(name);
    })


})

function linkTo(currentPageNo) {
    var name = jQuery("#goodsName").val()
    location.href = "?name=" + encodeURI(name) + "&currentPageNo=" + currentPageNo;
}

function pageTo() {
    var page = document.getElementById("inputPage").value;
    var maxPage = jQuery
    {
        pageTool.totalPageCount
    }
    ;
    if (isNaN(page)) {
        alert("页码请输入数字。");
    } else {
        if (page == "") {
            page = jQuery
            {
                pageTool.currentPageNo
            }
            ;
        }

        var pageNum = parseInt(page);
        if (pageNum <= 0) {
            pageNum = 1;
        }
        if (pageNum > maxPage) {
            pageNum = maxPage;
        }
        var name = jQuery("#goodsName").val()
        location.href = "?name=" + encodeURI(name) + "&currentPageNo=" + pageNum;
    }


}

function remove(id, goodsName) {
    let size = jQuery(".data tr").size();
    if (confirm("请确定是否需要删除[" + goodsName + "]这个账户")) {
        jQuery.post("removeGoodsById", {id: id}, function (mes) {
            if (mes > 0) {
                alert("删除成功");
                jQuery("#goods" + id).parent().remove();
            } else {
                alert("删除失败!");
            }
        })

    }
}

